﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewsEditControl.ascx.cs" Inherits="Web.Views.Admin.Controls.News.NewsEditControl" %>
<%@ Register src="../ErrorControl.ascx" tagname="ErrorControl" tagprefix="uc1" %>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="
select
	&quot;TT_News&quot;.&quot;NewsID&quot; &quot;NewsID&quot;
	,&quot;TT_News&quot;.&quot;Title&quot; &quot;Title&quot;
	,&quot;TT_News&quot;.&quot;Txtpic&quot; &quot;Txtpic&quot;
	,&quot;TT_News&quot;.&quot;ShowImgUrl&quot; &quot;ShowImgUrl&quot;
	,&quot;TT_News&quot;.&quot;AreaID&quot; &quot;AreaID&quot;
	,&quot;TT_News&quot;.&quot;CategoryID&quot; &quot;CategoryID&quot;
	,&quot;TT_News&quot;.&quot;Author&quot; &quot;Author&quot;
	,&quot;TT_News&quot;.&quot;Source&quot; &quot;Source&quot;
	,&quot;TT_News&quot;.&quot;ContentInfo&quot; &quot;ContentInfo&quot;
	,&quot;TT_News&quot;.&quot;Hits&quot; &quot;Hits&quot;
	,&quot;TT_News&quot;.&quot;NewsDate&quot; &quot;NewsDate&quot;
	,&quot;TT_News&quot;.&quot;CreateOn&quot; &quot;CreateOn&quot;
from &quot;dbo&quot;.&quot;TT_News&quot; &quot;TT_News&quot;
where
	&quot;TT_News&quot;.&quot;NewsID&quot;=@NewsID" UpdateCommand="update &quot;dbo&quot;.&quot;TT_News&quot;
set
	&quot;Title&quot;=@Title
	,&quot;Txtpic&quot;=IsNull(@Txtpic, ((0)))
	,&quot;ShowImgUrl&quot;=@ShowImgUrl
	,&quot;AreaID&quot;=@AreaID
	,&quot;CategoryID&quot;=@CategoryID
	,&quot;Author&quot;=@Author
	,&quot;Source&quot;=@Source
	,&quot;ContentInfo&quot;=@ContentInfo
	,&quot;Hits&quot;=IsNull(@Hits, ((0)))
	,&quot;NewsDate&quot;=IsNull(@NewsDate, (getdate()))
	,&quot;CreateOn&quot;=IsNull(@CreateOn, (getdate()))
where
	&quot;NewsID&quot;=@NewsID" DeleteCommand="delete from &quot;dbo&quot;.&quot;TT_News&quot;
where
	&quot;NewsID&quot;=@NewsID" InsertCommand="insert into &quot;dbo&quot;.&quot;TT_News&quot;(
	&quot;Title&quot;
	,&quot;Txtpic&quot;
	,&quot;ShowImgUrl&quot;
	,&quot;AreaID&quot;
	,&quot;CategoryID&quot;
	,&quot;Author&quot;
	,&quot;Source&quot;
	,&quot;ContentInfo&quot;
	,&quot;Hits&quot;
	,&quot;NewsDate&quot;
	,&quot;CreateOn&quot;)
values (
	@Title
	,IsNull(@Txtpic, ((0)))
	,@ShowImgUrl
	,@AreaID
	,@CategoryID
	,@Author
	,@Source
	,@ContentInfo
	,IsNull(@Hits, ((0)))
	,IsNull(@NewsDate, (getdate()))
	,IsNull(@CreateOn, (getdate())))" 
   
    ConnectionString='<%$ ConnectionStrings:ConnectionString %>'><SelectParameters><asp:QueryStringParameter Name="NewsID" QueryStringField="NewsID" Type="Int32" /></SelectParameters><UpdateParameters>
    <asp:Parameter name="Title" Type="String" />
    <asp:Parameter name="Txtpic" Type="Boolean" />
    <asp:Parameter name="ShowImgUrl" Type="String" />
    <asp:Parameter name="AreaID" Type="Int32" />
    <asp:Parameter name="CategoryID" Type="Int32" />
    <asp:Parameter name="Author" Type="String" />
    <asp:Parameter name="Source" Type="String" />
    <asp:Parameter name="ContentInfo" Type="String" />
    <asp:Parameter name="Hits" Type="Int32" />
    <asp:Parameter name="NewsDate" Type="DateTime" />
    <asp:Parameter name="CreateOn" Type="DateTime" /><asp:Parameter name="NewsID" Type="Int32" />
    </UpdateParameters><DeleteParameters><asp:Parameter name="NewsID" Type="Int32" /></DeleteParameters><InsertParameters><asp:Parameter name="Title" Type="String" />
    <asp:Parameter name="Txtpic" Type="Boolean" />
    <asp:Parameter name="ShowImgUrl" Type="String" />
    <asp:Parameter name="AreaID" Type="Int32" />
    <asp:Parameter name="CategoryID" Type="Int32" />
    <asp:Parameter name="Author" Type="String" />
    <asp:Parameter name="Source" Type="String" />
    <asp:Parameter name="ContentInfo" Type="String" />
    <asp:Parameter name="Hits" Type="Int32" />
    <asp:Parameter name="NewsDate" Type="DateTime" />
    <asp:Parameter name="CreateOn" Type="DateTime" /></InsertParameters></asp:SqlDataSource>
<div class="TaskList">
  <div class="Task">Click <asp:LinkButton ID="BackToList" runat="server" CommandName="Cancel" Text="here" OnClick="BackToList_Click" /> to return back to the previous screen.<uc1:ErrorControl 
          ID="ErrorControl1" runat="server" />
    </div>
</div>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
    DataSourceID="SqlDataSource1" OnItemUpdated="DetailsView1_ItemUpdated" 
    OnItemInserted="DetailsView1_ItemInserted" 
    OnItemDeleted="DetailsView1_ItemDeleted" 
    OnItemCommand="DetailsView1_ItemCommand" DataKeyNames="NewsID" 
    oniteminserting="DetailsView1_ItemInserting"><Fields><asp:CommandField ShowEditButton="True" ShowDeleteButton="True" ShowInsertButton="True" />
    <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" 
        ControlStyle-Width="400px" ItemStyle-Width="416px" 
        ItemStyle-CssClass="Required" >
<ControlStyle Width="400px"></ControlStyle>

<ItemStyle CssClass="Required" Width="416px"></ItemStyle>
    </asp:BoundField>
    <asp:TemplateField HeaderText="地区">
        <InsertItemTemplate>
        <asp:DropDownList runat="server" AutoPostBack="true" ID="ddlArea">
        <asp:ListItem Text="北京" Selected="True" Value="127"></asp:ListItem>
         <asp:ListItem Text="上海"  Value="147"></asp:ListItem>
         <asp:ListItem Text="天津"  Value="168"></asp:ListItem>
         <asp:ListItem Text="重庆"  Value="188"></asp:ListItem>
         <asp:ListItem Text="安徽"  Value="230"></asp:ListItem>
         <asp:ListItem Text="福建"  Value="249"></asp:ListItem>
         <asp:ListItem Text="甘肃"  Value="260"></asp:ListItem>
         <asp:ListItem Text="河北"  Value="278"></asp:ListItem>
         <asp:ListItem Text="黑龙江"  Value="291"></asp:ListItem>
         <asp:ListItem Text="广东"  Value="306"></asp:ListItem>
         <asp:ListItem Text="广西"  Value="329"></asp:ListItem>
         <asp:ListItem Text="贵州"  Value="346"></asp:ListItem>
         <asp:ListItem Text="河南"  Value="357"></asp:ListItem>
         <asp:ListItem Text="湖北"  Value="377"></asp:ListItem>
         <asp:ListItem Text="湖南"  Value="396"></asp:ListItem>
         <asp:ListItem Text="海南"  Value="412"></asp:ListItem>
         <asp:ListItem Text="江苏"  Value="433"></asp:ListItem>
         <asp:ListItem Text="江西"  Value="449"></asp:ListItem>
         <asp:ListItem Text="吉林"  Value="462"></asp:ListItem>
         <asp:ListItem Text="辽宁"  Value="473"></asp:ListItem>
         <asp:ListItem Text="内蒙古"  Value="489"></asp:ListItem>
         <asp:ListItem Text="宁夏"  Value="503"></asp:ListItem>
         <asp:ListItem Text="青海"  Value="509"></asp:ListItem>
         <asp:ListItem Text="山东"  Value="519"></asp:ListItem>
         <asp:ListItem Text="山西"  Value="538"></asp:ListItem>
         <asp:ListItem Text="陕西"  Value="551"></asp:ListItem>
         <asp:ListItem Text="四川"  Value="563"></asp:ListItem>
         <asp:ListItem Text="新疆"  Value="586"></asp:ListItem>
         <asp:ListItem Text="西藏"  Value="601"></asp:ListItem>
         <asp:ListItem Text="云南"  Value="610"></asp:ListItem>
         <asp:ListItem Text="浙江"  Value="628"></asp:ListItem>
         
         


        </asp:DropDownList>
           
            <asp:DropDownList ID="ddlAreaCity" runat="server" 
                DataSourceID="SqlDataSource3" DataTextField="Text" DataValueField="ID" 
                 >
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT [ID], [Text] FROM [Area] WHERE ([PID] = @PID)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="ddlArea" Name="PID" 
                        PropertyName="SelectedValue" Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>
        </InsertItemTemplate>
    </asp:TemplateField>
    <asp:CheckBoxField DataField="Txtpic" HeaderText="txtpic" 
        SortExpression="Txtpic" />
    <asp:BoundField DataField="ShowImgUrl" HeaderText="Show Img Url" SortExpression="ShowImgUrl" />
    <asp:TemplateField HeaderText="类别">
        <ItemTemplate>
            <asp:Label ID="Label2" runat="server" Text='<%# Eval("CategoryID") %>'></asp:Label>
        </ItemTemplate>
        <InsertItemTemplate>
            <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="sdsCategory" 
                DataTextField="Text" DataValueField="NewsCategoryID" 
                SelectedValue='<%# Bind("CategoryID") %>'>
            </asp:DropDownList>
            <asp:SqlDataSource ID="sdsCategory" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT [NewsCategoryID], [ParentID], [Text] FROM [NewsCategory] WHERE ([ParentID] = @ParentID) ORDER BY [Sort]">
                <SelectParameters>
                    <asp:Parameter DefaultValue="0" Name="ParentID" Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>
        </InsertItemTemplate>
    
    </asp:TemplateField>
    
    <asp:BoundField DataField="Author" HeaderText="作者" SortExpression="Author" 
        ControlStyle-Width="400px" ItemStyle-Width="416px" >
<ControlStyle Width="400px"></ControlStyle>

<ItemStyle Width="416px"></ItemStyle>
    </asp:BoundField>
    <asp:BoundField DataField="Source" HeaderText="来源" SortExpression="Source" 
        ControlStyle-Width="400px" ItemStyle-Width="416px" >
<ControlStyle Width="400px"></ControlStyle>

<ItemStyle Width="416px"></ItemStyle>
    </asp:BoundField>
    <asp:TemplateField HeaderText="内容" SortExpression="ContentInfo" ItemStyle-Width="312px" ItemStyle-CssClass="Required"><EditItemTemplate><asp:TextBox ID="TextBox1" runat="server" Columns="50" Rows="5" TextMode="MultiLine" Text='<%# Bind("ContentInfo") %>'>
        </asp:TextBox></EditItemTemplate>
        <InsertItemTemplate>
        <input type="hidden" runat="server"  name="sContent" id="sContent" value='<%# Bind("ContentInfo") %>' /></p>
 <iframe src="../../../Content/163editor/editor.html?id=NewsEditControl1_DetailsView1_sContent" frameborder="0" scrolling="no" width="670" height="320"></iframe>
        </InsertItemTemplate>
        <ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("ContentInfo") %>'>
        </asp:Label></ItemTemplate>
<ItemStyle CssClass="Required" Width="312px"></ItemStyle>
    </asp:TemplateField>
    <asp:BoundField DataField="Hits" HeaderText="Hits" SortExpression="Hits" 
        ControlStyle-Width="120px" ItemStyle-Width="136px" >
<ControlStyle Width="120px"></ControlStyle>

<ItemStyle Width="136px"></ItemStyle>
    </asp:BoundField>
    <asp:BoundField DataField="NewsDate" HeaderText="News Date" 
        SortExpression="NewsDate" HtmlEncode="false" DataFormatString="{0:d}" 
        ControlStyle-Width="80px" ItemStyle-Width="96px" >
<ControlStyle Width="80px"></ControlStyle>

<ItemStyle Width="96px"></ItemStyle>
    </asp:BoundField>
    <asp:BoundField DataField="CreateOn" HeaderText="Create On" 
        SortExpression="CreateOn" HtmlEncode="false" DataFormatString="{0:d}" 
        ControlStyle-Width="80px" ItemStyle-Width="96px" >
<ControlStyle Width="80px"></ControlStyle>

<ItemStyle Width="96px"></ItemStyle>
    </asp:BoundField>
    <asp:CommandField ShowEditButton="True" ShowDeleteButton="True" ShowInsertButton="True" /></Fields></asp:DetailsView>
